package com.efast.dmom.equipment.controller.check;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.efast.dmom.equipment.bean.checkplan.EquipCheckPlanBean;
import com.efast.dmom.equipment.bean.checkplan.EquipCheckingTaskEquipBean;
import com.efast.dmom.equipment.service.checking.IEquipCheckingPlanService;

/**
 * zmm
 */
@Controller
@RequestMapping("/equipment")
public class CheckPlanController  {

	@Autowired
	private IEquipCheckingPlanService iEquipCheckingPlanService;

	@RequestMapping(value = "/checking/plan/add", method = RequestMethod.POST)
	public @ResponseBody void addCheckingPlan(@RequestBody EquipCheckPlanBean bean) {
		iEquipCheckingPlanService.addCheckingPlan(bean);
	}

	@RequestMapping(value = "/checking/plan/update", method = RequestMethod.POST)
	public @ResponseBody void updateCheckingPlan(@RequestBody EquipCheckPlanBean bean) {
		iEquipCheckingPlanService.updateCheckingPlan(bean);
	}

	@RequestMapping(value = "/checking/plan/delete", method = RequestMethod.POST)
	public @ResponseBody void deleteCheckingPlan(@RequestBody EquipCheckPlanBean bean) {
		iEquipCheckingPlanService.deleteCheckingPlan(bean);
	}
	
	@RequestMapping(value = "/checking/plan/selectEquipProgramByPlanId", method = RequestMethod.POST)
	public @ResponseBody
	List<EquipCheckingTaskEquipBean> selectCheckingTaskProgramByPlanId(@RequestBody EquipCheckPlanBean bean) {
		return iEquipCheckingPlanService.selectCheckingTaskProgramById(bean.getId());
	}

	@RequestMapping(value = "/checking/plan/selectCheckingTaskProgramItemByTaskId", method = RequestMethod.POST)
	public @ResponseBody
	List<EquipCheckingTaskEquipBean> selectCheckingTaskProgramItemByTaskId(@RequestBody EquipCheckPlanBean bean) {
		return iEquipCheckingPlanService.selectCheckingTaskProgramById(bean.getId());
	}
}
